/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package button_tools;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;

/**
 *
 * @author tnull
 */

// RECTANGLE extends Shape, implements its own drawing method
// as required.
public class TRectangle extends TShape {

    // Constructor - takes a color object, and two points
    // and sets a type
    public TRectangle(Color c, int x, int y, int w, int h) {
        super(c, x, y, w, h);
        this.setType(SHAPE_TYPE.RECTANGLE);
    }

    
    // drawing method...check to see if its filled, set the color of the
    // graphics object, and draw the rectangle.
    @Override
    protected void draw(Graphics2D g2d) {
        g2d.setColor(m_Color);
        if (m_Filled) {
            g2d.fill(new Rectangle2D.Double(m_x, m_y, m_width-m_x, m_height-m_y));
        } else {
            g2d.draw(new Rectangle2D.Double(m_x, m_y, m_width-m_x, m_height-m_y));
        }
    }

}
